#include <stdio.h>

int n, m;
int data[1000013] = {0};

int query(int val)
{
    // binary search
    int L = 1;
    int R = n;
    int P = n / 2;
    while (1)
    {
        if (data[P] == val || L >= R)
        {
            if (data[P] != val)
                return -1;
            break;
        }
        else if (data[P] > val)
        {
            R = P - 1;
            P = (L + R) / 2;
        }
        else
        {
            L = P + 1;
            P = (L + R) / 2;
        }
    }

    // rewind
    for (; P > 0; --P)
    {
        if (data[P - 1] != data[P])
            break;
    }
    return P;
}

int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; ++i)
    {
        scanf("%u", data + i);
    }
    for (int i = 0; i < m; ++i)
    {
        int k;
        scanf("%d", &k);
        printf("%d ", query(k));
    }
    return 0;
}